import { View, Image } from "@tarojs/components";
import successIcon from '@/assets/images/success.png'
import finishBg from '@/assets/images/finish-bg.png'
import Taro from "@tarojs/taro";
import useProfileStatusAction from "@/hooks/useProfileStatusAction";
import { useEffect, useState } from "react";
import { APPOINTMENT_NOTICE_ID, EAXMINE_NOTICE_ID, PAGE_PATH } from "@/common/config";
import {   subscribeMessage } from "@/common/util";
const ExamineProcess: React.FC = () => {
    const {  handleInitProfileStatus, promptMessage } = useProfileStatusAction();
    const [showCompleteBtn, setShowCompleteBtn] = useState(false)

    const hanldeGoIndex = () => {
        

        subscribeMessage([EAXMINE_NOTICE_ID,APPOINTMENT_NOTICE_ID]).then(()=>{
          
            Taro.switchTab({ url: PAGE_PATH.INDEX })
        })
    }
    const handleInitShow = () => {
        const currentInstance = Taro.getCurrentInstance();
        if (currentInstance && currentInstance.router) {
            const routerParams = currentInstance.router.params
            const pageEntry = routerParams.pageEntry;
            if (pageEntry === '2') {
                setShowCompleteBtn(true)
            } else {
                setShowCompleteBtn(false)
            }

        }
    }
    useEffect(() => {
        handleInitShow()
        handleInitProfileStatus()
    }, [])
    return <>
        <View className='min-h-100vh box-border flex flex-col items-center py-20px  justify-center'>
            <Image src={successIcon} className="w-156px h-156px"></Image>
            <View className="mt-40px text-#161618 text-36px font-bold">信息审核中</View>
            <View className="mt-40px text-#161618 text-28px text-center leading-46px">
                <View>{promptMessage[0]}</View>
                {/* <View>{promptMessage[1]}</View> */}

            </View>
            {/* <View className="mt-70px text-#161618 text-28px">关注公众号接收审核结果等消息通知

        </View> */}
            {/* <Image className="w-272px h-272px mt-18px" src={subscribeQrCodeUrl} showMenuByLongpress={true}></Image>
            <View className="mt-18px text-#161618 text-28px">长按二维码识别关注

            </View> */}
            {
                showCompleteBtn && <View onClick={hanldeGoIndex} className="w-400px h-106px  flex items-center justify-center text-#333333 mt-76px text-36px " style={{ backgroundImage: `url(${finishBg})`, backgroundRepeat: 'no-repeat', backgroundSize: '100% 100%' }}>完成</View>
            }

        </View>
    </>

}
export default ExamineProcess;